// ============================== 导入依赖 ============================== //

import CORE from '@/CORE'

const END_INDEX = {
  1: 10,
  2: 7,
  3: 4,
}

// ============================== 导出计算属性 ============================== //

export default {
  /**
   * 自定义计算属性 (可覆盖)
   */
  GETTER: ({ param, DICT: { CATEGORY = [], TYPE = [] } }) => {
    const category = CORE.dict(CATEGORY, param.statisticType)
    const type = CORE.dict(TYPE, param.energyType)

    // 导出的文件名称
    const date = CORE.dateStr(param.statisticTime).slice(0, END_INDEX[param.dateType])
    const fileName = `用能报表 [${category}] [${type}] [${date}]`

    return {
      category: param.statisticType === 5 ? '监测点' : category.slice(0, 2),
      type,
      fileName,
    }
  },
}
